package org.game.db.proxy.bean;

import com.sojoys.artifact.build.data.base.BasePojoProxy;
import com.sojoys.artifact.tools.ToolMap;
import org.cfg.DatingRuleCfg;
import org.cfg.cache.DatingRuleCfgCache;
import org.constant.DatingConstant;
import org.game.db.bean.CityDatingRecord;

import java.util.Date;
import java.util.List;

/**
 * Created by fxf on 2018-3-15.
 */
public class CityDatingRecordProxy extends BasePojoProxy<CityDatingRecordProxy, CityDatingRecord> {

    public DatingRuleCfg getCfg(){
        return DatingRuleCfgCache.me().getById(t.getCid());
    }

    public List<Integer> getRoleCids(){
        return (List<Integer>) getCfg().getEnterCondition().get(DatingConstant.ENTER_CDTION_KEY_ROLE_CIDS);
    }

    public void setTriggerTime(Date date){
        t.getInfo().put(DatingConstant.TRIGGER_TIME,date);
    }

    public Date getTriggerTime(){
        return (Date) t.getInfo().get(DatingConstant.TRIGGER_TIME);
    }

    //~~~~~~~~~~~~~~~~~预定约会~~~~~~~~~~~~~~~~~

    public void setState(int state){//setReserveDatingState
        t.getInfo().put(DatingConstant.RESERVE_DATING_STATE,state);
    }

    public int getState(){//getReserveDatingState
        return ToolMap.getInt(DatingConstant.RESERVE_DATING_STATE,t.getInfo(),0);
    }

    public void setDatingBeginTime(long beginTime){
        t.getInfo().put(DatingConstant.DATING_BEGIN_TIME,beginTime);
    }

    public long getDatingBeginTime(){
        return ToolMap.getLong(DatingConstant.DATING_BEGIN_TIME,t.getInfo(),0);
    }

    public void setDatingEndTime(long endTime){
        t.getInfo().put(DatingConstant.DATING_END_TIME,endTime);
    }

    public long getDatingEndTime(){
        return ToolMap.getLong(DatingConstant.DATING_END_TIME,t.getInfo());
    }

    /**
     * 时间段
     */
    public List<Integer> getDatingTimeFrame() {
        return (List<Integer>) t.getInfo().get(DatingConstant.TIME_FRAME);
    }

    /**
     * 预定约会：约会时间段
     */
    public void setDatingTimeFrame(List<Integer> timeFrame) {
        t.getInfo().put(DatingConstant.TIME_FRAME,timeFrame);
    }
}
